/*
 * TakeingMoveFrameBackend.java
 * Team qq 2011
 */
package com.google.code.timetrail.gui;

import com.google.code.timetrail.backend.Control;
import com.google.code.timetrail.backend.Place;

/**
 * @author jake.gibel@gmail.com
 * @version 1.0.0
 */
public class TakingMoveFrameBackend {
	/**
	 * the data for the game
	 */
	private final Control gameControl;

	/**
	 * Creates a new TakingMoveFrameBackend
	 * 
	 * @param gameControl
	 *            the game data
	 */
	public TakingMoveFrameBackend(Control gameControl) {
		this.gameControl = gameControl;

	}

	/**
	 * @return The text that goes into PaceRationsButton
	 */
	public String getPaceRationsButtonText() {
		return "Change Pace/Ration";
	}

	/**
	 * @return the text that is in the Continue button
	 */
	public String getContinueButtonText() {
		return "Continue";
	}

	/**
	 * @return the Amount of food
	 */
	public String getFoodLabelText() {
		return "Food: " + gameControl.getInv().getFood().getCurrentAmount();
	}

	/**
	 * 
	 * @return What the Rations are set to
	 */
	public String getRationsLabelText() {
		return "Rations are set to " + gameControl.getRations().getName();
	}

	/**
	 * @return What the current Distance is
	 */
	public String getDistanceLabelText() {
		return "Distance: " + gameControl.getTime().getTimeTraveled();
	}

	/**
	 * 
	 * @return What the pace is set to
	 */
	public String getPaceLabelText() {
		return "Pace is set to " + gameControl.getPace().getName();
	}

	/**
	 * @return What the current location is
	 */
	public String getCurrentLocText() {
		if (gameControl.getCurrentPlace() == Place.TRANSIT) {
			return "";
		} else if (gameControl.getCurrentPlace() == Place.OREGON) {
			return "Congratulations! You have arrived at "
					+ gameControl.getCurrentPlace().getName();
		} else if (gameControl.getCurrentPlace() == Place.INDEPENDECE) {
			return "You are at " + gameControl.getCurrentPlace().getName();
		} else {
			return "You have reached "
					+ gameControl.getCurrentPlace().getName();
		}
	}

	/**
	 * @return Which turn it is
	 */
	public String getTurnLabelText() {
		return "Turn: " + gameControl.getTime().getTurn();
	}

	/**
	 * tells gameControl to take a turn
	 */
	public void pressContinue() {
		gameControl.takeATurn();
	}

	/**
	 * @return the string representation of TakingMoveBackend
	 */
	public String toString() {
		return "TakingMoveBackend";
	}

	/**
	 * This is used to determine whther or not to show the river crossing screen
	 * @return whether or not the current location is a river crossing
	 */
	public boolean isRiverCrossing() {
		return gameControl.getCurrentPlace().hasRiverCross();
	}

	/**
	 * 
	 * @return if the game has an event tha tit wants to display
	 */
	public boolean hasEvent() {
		return gameControl.getNextEvent().getMessageText() != gameControl.getNextEvent().getDummyText();
	}
}
